﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AgentPage/CampusAgent.master" AutoEventWireup="true" CodeFile="AgentHotelList.aspx.cs" Inherits="AgentPage_AgentHotelList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <link href="AgentHotelList.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .style1
        {
            width: 166px;
        }
        .style2
        {
            width: 100%;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div id="contenthotel">
    <div id="contenthotel_left">
    <table border="0" cellspacing="0" cellpadding="0" width="100%">
    	<tr>
    		<td class="style1">
                
            </td>
            <td>
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <asp:Label ID="Label_time" runat="server" Text="Label" Visible="False"></asp:Label>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
    	</tr>
    	<tr>
    		<td class="style1">
                <asp:Label ID="Label1" runat="server" Text="按条件筛选"></asp:Label></td>
            <td></td>
    	</tr>
        <tr>
    		<td class="style1">
                <asp:Label ID="Label_province" runat="server" Text="所在省份："></asp:Label></td>
            <td>
                <asp:DropDownList ID="DropDownList_province" runat="server" 
                    DataSourceID="SqlDataSource_province" DataTextField="province" 
                    DataValueField="province" AutoPostBack="True">
                    <asp:ListItem Value=" ">未选择</asp:ListItem>
                </asp:DropDownList>
                <asp:SqlDataSource ID="SqlDataSource_province" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:ConnString %>" 
                    SelectCommand="SELECT DISTINCT province FROM HotelView"></asp:SqlDataSource>
            </td>
    	</tr>
        <tr>
    		<td class="style1">
                <asp:Label ID="Label_city" runat="server" Text="所在市："></asp:Label></td>
            <td>
                <asp:DropDownList ID="DropDownList_city" runat="server" 
                    DataSourceID="SqlDataSource_city" DataTextField="city" 
                    DataValueField="city" AutoPostBack="True">
                    <asp:ListItem Value=" ">未选择</asp:ListItem>
                </asp:DropDownList>
                <asp:SqlDataSource ID="SqlDataSource_city" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:ConnString %>" 
                    
                    SelectCommand="SELECT DISTINCT [city] FROM [HotelView] WHERE ([province] = @province)">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="DropDownList_province" Name="province" 
                            PropertyName="SelectedValue" Type="String" />
                    </SelectParameters>
                </asp:SqlDataSource>
            </td>
    	</tr>
       <tr>
    		<td class="style1">
                <asp:Label ID="Label_county" runat="server" Text="所在县/区:"></asp:Label></td>
            <td>
                <asp:DropDownList ID="DropDownList_county" runat="server" 
                    DataSourceID="SqlDataSource_county" DataTextField="county" 
                    DataValueField="county" AutoPostBack="True">
                </asp:DropDownList>
                <asp:SqlDataSource ID="SqlDataSource_county" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:ConnString %>" 
                    
                    SelectCommand="SELECT DISTINCT [county] FROM [HotelView] WHERE (([province] = @province) AND ([city] = @city))">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="DropDownList_province" Name="province" 
                            PropertyName="SelectedValue" Type="String" />
                        <asp:ControlParameter ControlID="DropDownList_city" Name="city" 
                            PropertyName="SelectedValue" Type="String" />
                    </SelectParameters>
                </asp:SqlDataSource>
            </td>
    	</tr>
      
       <tr>
    		<td class="style1">
                &nbsp;</td>
            <td>
                &nbsp;</td>
    	</tr>
      
       <tr>
    		<td class="style1">
                <asp:Label ID="Label_sebyname" runat="server" Text="名字:" />
            </td>
            <td>
                <asp:TextBox ID="TextBox_sebyname" runat="server"></asp:TextBox>
            </td>
    	</tr>
      
       <tr>
    		<td class="style1">
                &nbsp;</td>
            <td>
                <asp:Button ID="Button_selok" runat="server" Text="确定" />
            </td>
    	</tr>
      
    </table>

    </div>
    <div id="contenthotel_right">
        <table class="style2">
            <tr>
                <td>
                   
        
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
            AutoGenerateColumns="False" DataSourceID="SqlDataSource_hoteltable" 
                        DataKeyNames="hotelID" AllowSorting="True">
            <Columns>
                <asp:CommandField ShowSelectButton="True" />
                <asp:BoundField DataField="hotelID" HeaderText="hotelID" 
                    SortExpression="hotelID" ReadOnly="True" Visible="False" />
                <asp:BoundField DataField="名称" HeaderText="名称" SortExpression="名称" />
                <asp:BoundField DataField="省份" HeaderText="省份" 
                    SortExpression="省份" ReadOnly="True" />
                <asp:BoundField DataField="城市" HeaderText="城市" 
                    SortExpression="城市" ReadOnly="True" />
                <asp:BoundField DataField="县/区" HeaderText="县/区" 
                    SortExpression="县/区" ReadOnly="True" />
                <asp:BoundField DataField="地址" HeaderText="地址" SortExpression="地址" />
                <asp:BoundField DataField="电话" HeaderText="电话" SortExpression="电话" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource_hoteltable" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnString %>" 
            
            
            
                        
                        SelectCommand="SELECT DISTINCT hotelID, hotelname AS '名称', province AS '省份', city AS '城市', county AS '县/区', address AS '地址', telephonenumber AS '电话' FROM HotelView WHERE (city = @city OR @city = '') AND (province = @province OR @province = '') AND (county = @county OR @county = '') AND (hotelname LIKE '%' + @hotelname + '%' OR @hotelname = '')">
            <SelectParameters>
                <asp:ControlParameter ControlID="DropDownList_city" Name="city" 
                    PropertyName="SelectedValue" Type="String" DefaultValue=" " />
                <asp:ControlParameter ControlID="DropDownList_province" Name="province" 
                    PropertyName="SelectedValue" Type="String" DefaultValue=" " />
                <asp:ControlParameter ControlID="DropDownList_county" Name="county" 
                    PropertyName="SelectedValue" Type="String" DefaultValue=" " />
                <asp:ControlParameter ControlID="TextBox_sebyname" Name="hotelname" 
                    PropertyName="Text" Type="String" DefaultValue=" " />
            </SelectParameters>

        </asp:SqlDataSource>
          </td>
                <td>
                <asp:GridView ID="GridView2" runat="server" AllowPaging="True" 
            AllowSorting="True" AutoGenerateColumns="False" 
            DataSourceID="SqlDataSource_room">
            <Columns>
                <asp:BoundField DataField="房间名" HeaderText="房间名" SortExpression="房间名" />
                <asp:BoundField DataField="空余开始时间" HeaderText="空余开始时间" 
                    SortExpression="空余开始时间" />
                <asp:BoundField DataField="结束时间" HeaderText="结束时间" SortExpression="结束时间" />
                <asp:BoundField DataField="大小" HeaderText="大小" SortExpression="大小" />
                <asp:BoundField DataField="价格" HeaderText="价格" SortExpression="价格" />
            </Columns>
        </asp:GridView>
                    <asp:SqlDataSource ID="SqlDataSource_room" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:ConnString %>" 
                        
                        
                        
                        SelectCommand="SELECT roomname AS '房间名', startfreetime AS '空余开始时间', endfreetime AS '结束时间', roomsize AS '大小', price AS '价格' FROM RoomTable WHERE (hotelID = @hotelID) AND (freestate = @freestate) AND (endfreetime &gt;= @endfreetime)">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="GridView1" Name="hotelID" 
                                PropertyName="SelectedValue" Type="String" />
                            <asp:Parameter DefaultValue="0" Name="freestate" Type="String" />
                            <asp:ControlParameter ControlID="Label_time" DefaultValue="" Name="endfreetime" 
                                PropertyName="Text" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                </td>
            </tr>
        </table>
        <div id="contenthotel_right_bottom">
           <!--<asp:LinkButton ID="LinkButton_lastpage" runat="server">上一页</asp:LinkButton>
           &nbsp;
           <asp:LinkButton ID="LinkButton1" runat="server">1</asp:LinkButton>
           &nbsp;
           <asp:LinkButton ID="LinkButton2" runat="server">2</asp:LinkButton>
           &nbsp;
           <asp:LinkButton ID="LinkButton3" runat="server">3</asp:LinkButton>
           &nbsp;
           <asp:LinkButton ID="LinkButton4" runat="server">4</asp:LinkButton>
           &nbsp;
           <asp:Label ID="Label_pagenone" runat="server" Text="......"></asp:Label>
           &nbsp;
           <asp:LinkButton ID="LinkButton6" runat="server">5</asp:LinkButton>
           &nbsp;
           <asp:LinkButton ID="LinkButton5" runat="server">6</asp:LinkButton>
           &nbsp;
           <asp:LinkButton ID="LinkButton_nextpage" runat="server">下一页</asp:LinkButton>
           -->
        </div>
        
    </div>
        
</div>

</asp:Content>

